﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;

public partial class MissingPersons : System.Web.UI.Page
{
    
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection();
        con.ConnectionString = ConfigurationManager.ConnectionStrings["PAS_DB"].ConnectionString;
        SqlCommand cmd = new SqlCommand("insert into MissingPerson values(@ID_number ,@fname, @lname, @id_mark, @Loc, @date)", con);
        cmd.Parameters.AddWithValue("@ID_number", IDnoTextBox.Text);
        cmd.Parameters.AddWithValue("@Fname", FnameTextBox.Text);
        cmd.Parameters.AddWithValue("@Lname", LnameTextBox.Text);
        cmd.Parameters.AddWithValue("@ID_mark", IDTextBox.Text);
        cmd.Parameters.AddWithValue("@Loc", LocTextBox.Text);
        cmd.Parameters.AddWithValue("@Date", DateTextBox.Text);
        con.Open();
        int i = cmd.ExecuteNonQuery();
        if (i > 0)
        {
            ResLabel.Text = "data inserted";
        }
        con.Close();
    }
}